<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<HEAD>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<script language="javascript" src="../script/common.js"></script>
	<script>
		var qt = {}
		function load(){
			createTable();
		}
		/**查询部分**/
		//生成查询语句
		function createQuery(){
			var location = Common.cOrg().id;
			var q = new Query("select o.id,g.giftName,g.type,g.baseUOM,g.price from GiftLocationInventory as o join o.giftLocation as org join o.gift as g where org.id="+location);
			q.add(" and g.price = ?",$("o.price"),Query.Float);
			q.add(" and g.type = ?",$("o.type"),Query.Long);
			return q;
		}
		
		//设置表格数据列
		function createColumn(){
			var columns = [						
				{type:"radio"},
				{title:"商品名称",width:"25%"},
				{title:"商品类型",width:"25%"},
				{title:"计量单位",width:"25%"},
				{title:"价格",width:"20%"}
			]
			return columns;
		}
		//生成表格，创建QueryTable对象
		function createTable(){
			qt = new QueryTable("datalist",createQuery,createColumn());
			showData();					//显示查询结果方法
		}
		
		//显示、刷新表格
		function showData(){	
			qt.showTable();				//qt为全局的QueryTable对象
		}
		
	function getBackValue(){
		var radio = Common.getRadio();
		if (!radio){						
			return;
		}
		var floor = radio.id.split("_")[1];
		var obj = qt.objects[floor];
		var v = {id : obj[0],
				name : obj[1]
		}
		return v;
	}		
	
	function onSave(){
		var v = getBackValue();
		dialogBackValue(v)
	}
	
	</script>
	</HEAD>
<BODY class="body" onload='load()'>
	<div id="listview">	
		<!--查询条件form-->
		<div class="form">
			<table cellSpacing=0 cellPadding=4 width="100%" border=0>
				<tr>
					<td><label>商品类型</label> <input type="text" id="o.type" name="o.type"></td>
					<td><label>商品价格</label> <input type=text name="o.price" id="o.price"></td>
					<td><button type="button" onclick="showData()">查 询</button></td>
				</tr>
			</table>
		</div>
		<!--查询结构列表-->
		<div id=datalist>
		</div>
	</div>
</BODY>
</HTML>
